<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>字符串的扩展</title>
</head>
<body>
    <input type="text"/>
</body>
</html>
<script>
    //字符串unicode表示法(将码点放入大括号，就能正确解读该字符)
    let name = "hell\u{6F}";
    console.log("name",name);

    //2、codePointAt方法
    let s = "𠮷";
    console.log(s.length);
    console.log(s.charAt(0));
    console.log(s.charAt(1));

    // 4、字符串的遍历接口
    for(let  codePoint of "foo"){
        console.log(codePoint);
    }

    //5、模板字符串
    let person = {
        name:"zap",
        age:28
    };
    let message = `<h1>I am ${person.name}, I'm ${person.age} years old!</h1>`;
   document.getElementsByTagName("body")[0].innerHTML = message;

   //6、模板字符串中的大括号中可以使用任意的javascript变量
    let x =1,
        y = 2;
    let message2 = `${x} + ${y} = ${x+y}`;
    console.log(message2);

    //7、模板编译(转换为JavaScript再进行编译)
    let data = ["吕布","关羽","赵子龙","张翼德"];
    let template = `
        <ul>
        <% for(let i =0; i < data.length;i++){ %>
            <li><%= data[i] %></li>
        <% } %>
</ul>
    `;
    console.log(template);

    //8、标签模板
    alert`123`;

    //9、String.raw();
    let str = `Hi\n${2+3}`;
   console.log(str);
   let str2 = String.raw`Hello\n${2+3}!`;
   console.log(str2);

    //10、Number
    console.log(Number.isInteger(25));
    console.log(Number.isInteger(25.1));



</script>